package com.haitonghop.utils.sqllite.helper;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;

public class SQLiteTopicHaiBLHelper extends SQLLiteHelper {

	public static final String TABLE_TOPIC = "topiclist";
	public static final String COLUMN_ID = "_id";
	public static final String COLUMN_NAME = "_name";

	// Database creation sql statement
	private static final String DATABASE_CREATE = "create table "
			+ TABLE_TOPIC + "(" + COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT , "
			+ COLUMN_NAME + " text not null);";

	public SQLiteTopicHaiBLHelper(Context context) {
		super(context);
	}

	@Override
	public void onCreate(SQLiteDatabase database) {
		database.execSQL(DATABASE_CREATE);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		Log.w(SQLiteTopicHaiBLHelper.class.getName(),
				"Upgrading database from version " + oldVersion + " to "
						+ newVersion + ", which will destroy all old data");
		db.execSQL("DROP TABLE IF EXISTS " + TABLE_TOPIC);
		onCreate(db);
	}

}
